package com.anti.modular.bus.billwaterdetail.controller;

import com.anti.commom.annotation.BusinessLog;
import com.anti.commom.annotation.Permission;
import com.anti.commom.enums.LogAnnotionOpTypeEnum;
import com.anti.commom.api.Result;
import com.anti.jdbc.support.page.PageParam;
import com.anti.modular.bus.billwaterdetail.param.BillWaterDetailParam;
import com.anti.modular.bus.billwaterdetail.service.BillWaterDetailService;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;

import javax.annotation.Resource;

/**
 * 账单流水詳情控制器
 *
 * @author anti
 * @date 2021-04-24 13:44:50
 */
@RestController
@RequestMapping("billWaterDetail")
public class BillWaterDetailController {

    @Resource
    private BillWaterDetailService billWaterDetailService;

    /**
     * 查询账单流水詳情
     *
     * @author anti
     * @date 2021-04-24 13:44:50
     */
    @GetMapping("page")
    public Result page(PageParam pageParam, BillWaterDetailParam billWaterDetailParam) {
        return Result.data(billWaterDetailService.page(pageParam,billWaterDetailParam));
    }

    /**
     * 添加账单流水詳情
     *
     * @author anti
     * @date 2021-04-24 13:44:50
     */
    @Permission
    @PostMapping("add")
    @BusinessLog(title = "账单流水詳情_增加", opType = LogAnnotionOpTypeEnum.ADD)
    public Result add(@RequestBody @Validated(BillWaterDetailParam.add.class) BillWaterDetailParam billWaterDetailParam) {
            billWaterDetailService.add(billWaterDetailParam);
        return Result.success("新增成功");
    }

    /**
     * 删除账单流水詳情
     *
     * @author anti
     * @date 2021-04-24 13:44:50
     */
    @Permission
    @PostMapping("delete")
    @BusinessLog(title = "账单流水詳情_删除", opType = LogAnnotionOpTypeEnum.DELETE)
    public Result delete(@RequestBody @Validated(BillWaterDetailParam.delete.class) BillWaterDetailParam billWaterDetailParam) {
            billWaterDetailService.delete(billWaterDetailParam);
        return Result.success("删除成功");
    }

    /**
     * 编辑账单流水詳情
     *
     * @author anti
     * @date 2021-04-24 13:44:50
     */
    @Permission
    @PostMapping("edit")
    @BusinessLog(title = "账单流水詳情_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
    public Result edit(@RequestBody @Validated(BillWaterDetailParam.edit.class) BillWaterDetailParam billWaterDetailParam) {
            billWaterDetailService.edit(billWaterDetailParam);
        return Result.success("修改成功");
    }

    /**
     * 查看账单流水詳情
     *
     * @author anti
     * @date 2021-04-24 13:44:50
     */
    @GetMapping("detail")
    public Result detail(@Validated(BillWaterDetailParam.detail.class) BillWaterDetailParam billWaterDetailParam) {
        return Result.data(billWaterDetailService.detail(billWaterDetailParam));
    }

    /**
     * 账单流水詳情列表
     *
     * @author anti
     * @date 2021-04-24 13:44:50
     */
    @GetMapping("list")
    public Result list(BillWaterDetailParam billWaterDetailParam) {
        return Result.data(billWaterDetailService.list(billWaterDetailParam));
    }

}
